
package com.qf.dao.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.qf.dao.CategoryDao;
import com.qf.model.Category;
import com.qf.utils.C3P0Util;

public class CategoryDaoImpl implements CategoryDao{

	@Override
	public List<Category> findall() {
		QueryRunner qr = new QueryRunner(C3P0Util.getDatasource());
		List<Category> list =new ArrayList<>();
		try {
		list= qr.query("select * from category", new BeanListHandler<>(Category.class));
		} catch (SQLException e) {
			
			//TODO
			e.printStackTrace();
				
		}
		//TODO
		return list;
			
	}

}

	